package com.wyh.feign.config;

import com.wyh.feign.api.ProductAPI;
import com.wyh.feign.model.ProductInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;

@Slf4j
public class ProductFallbackFactory implements FallbackFactory<ProductAPI> {
    @Override
    public ProductAPI create(Throwable cause) {
        return new ProductAPI() {
            @Override
            public ProductInfo selectProductById(Integer productId) {
                log.error("查询产品信息异常！");
                return new ProductInfo();
            }
        };
    }
}
